<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="c" uri="/WEB-INF/tld/c.tld"%>
<!DOCTYPE HTML>
<html>
<head>
    <title>功能管理</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />  
    <base href="<%=basePath%>">
    <link rel="stylesheet" type="text/css" href="css/pager.css" />
    <link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="bootstrap/css/style.css" />
     <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }
        .mouseover:hover{cursor:hand;color:#0000FF}
    </style>
   <script type="text/javascript" src="js/jquery.min.js"></script>
	<script src="js/spring.pager.js"></script>
	<script type="text/javascript">
    	$(function (){  
    		$("#type").val(${type});
    		$("#pager").pager({ pagenumber: $("#current").val(), pagecount: $("#totalPage").val(), buttonClickCallback: PageClick});
    	});	
    	var PageClick = function(pageclickednumber) {
		    $("#current").val(pageclickednumber);
		    $("#syslogForm").submit();
		};	
		function  UpdateData(id){
			window.showModalDialog("authority/updateAuthorityInit.do?id="+id,"authority_add","dialogWidth=450;DialogHeight=350");
		};
		function AddData(){
			window.showModalDialog("system/authority_add.jsp","role_add","dialogWidth=450;DialogHeight=350");
		};
    </script>
    
</head>
<body >
<form name = "syslogForm" id = "syslogForm" class="form-inline definewidth m20" 
  action="authority/queryAuthority.do" method="post" >
             功能名称：
	<input name="name" id="name" value = "${param.name}" type="text" style="width:100px"
	/>
<!-- 	功能类型： -->
<!-- 	<input name="type" id="type" value = "${param.code}" type="text" style="width:100px" -->
<!-- 	/> -->
	URL：
	<input name="url" id="url" value = "${param.url}" type="text" style="width:100px"
	/>
	状态：
	<select  name = "status" id = "status" style="width:100px" >
    	<option value="">全部</option>
    	<option value = "0" <c:if test = "${param.status eq '0'}">selected</c:if>>无效</option>
    	<option value = "1" <c:if test = "${param.status eq '1'}">selected</c:if>>有效</option>
    </select>
	
    <input type="submit" class="btn btn-primary" value = "查询">
    <input type="button" class="btn btn-success" id="btnGetFocMonthData" 
					value="新建" onclick="AddData();" />
    <input type = "hidden" name = "pageSize" id = "pageSize" value="30"/>
	<input type = "hidden" name = "current" id = "current" value="${pageResult.current}"/>
	<input type = "hidden" name = "totalPage" id = "totalPage" value="${pageResult.totalPage}"/>
	
</form>
    <table class="table table-bordered table-hover definewidth m10">
	    <thead>
	    <tr>
	    	<th width=10%>ID</th>
	   		<th width=10%>名称</th>
<!-- 	        <th width=10%>类型</th> -->
	        <th width=10%>URL</th>
	        <th width=10%>状态</th>
	        <th width=10%>父ID</th>
<!-- 	        <th width=10%>更新日期</th> -->
	        <th width=10%>操作</th>
	    </tr>
	    </thead>
		<c:forEach items="${pageResult.list}" var="nsVar" varStatus = "status">
    	<tr>
    		<td>${nsVar.id}</td>
			<td>${nsVar.name}</td>
<!-- 			<td>${nsVar.type}</td> -->
			<td>${nsVar.url}</td>
			<td>
				<c:if test = "${nsVar.status=='0'}">无效</c:if>
	      		<c:if test = "${nsVar.status=='1'}">有效</c:if>
	      	</td>
	      	
	      	<td>${nsVar.parentId}</td>
<!-- 			<td>${nsVar.updateTime}</td> -->
			<td>
				<a href="javascript:void(0)"  onclick="UpdateData('${nsVar.id}');">修改</a>
			</td>
		</tr>
		</c:forEach>
	</table>
    <div id="pager" style="float:right;height:24px;padding-right:30px;"></div>


</body>
</html>